package com.deep.deepenterprise.api.controller.unit;

import com.deep.deepenterpise.common.enums.DrOrderTypeEnum;
import com.deep.deepenterpise.common.result.DrResult;
import com.deep.deepenterpise.model.to.unit.DrCarOrderPageTo;
import com.deep.deepenterpise.model.to.unit.DrCheckHouseOrderPageTo;
import com.deep.deepenterpise.model.to.unit.DrCheckHouseOrderTo;
import com.deep.deepenterpise.service.unit.IDrOrderService;
import com.deep.deepenterprise.api.threadlocal.DrLoginTokenContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author xyz
 * @version 1.0
 * @title DrOrderController
 * @description
 * @create 2024/5/14 03:05
 */
@RestController
@RequestMapping("/v12/interface/dr")
public class DrOrderController {
    @Resource
    private IDrOrderService iDrOrderService;

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 创建入户安检订单
     * @Time 14:12 2024/6/13
     * @Param [drCheckHouseOrderVo]
     */
    @PostMapping("/dr-add-check-house-order")
    public DrResult postDrAddCheckHouseOrder(@Validated @RequestBody DrCheckHouseOrderTo drCheckHouseOrderTo) {
        String drUserUuid = DrLoginTokenContext.getUserId();
        return iDrOrderService.postDrAddCheckHouseOrder(drUserUuid, drCheckHouseOrderTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 获取入户安检订单列表
     * @Time 20:53 2024/6/13
     * @Param [drCheckHouseOrderPageTo]
     */
    @PostMapping("/dr-check-house-order-list")
    public DrResult postDrCheckHouseOrderList(@Validated @RequestBody DrCheckHouseOrderPageTo drCheckHouseOrderPageTo) {
        String drUserUuid = DrLoginTokenContext.getUserId();
        drCheckHouseOrderPageTo.setDrType(DrOrderTypeEnum.CHECK_HOUSE.getDrType());
        return iDrOrderService.postDrCheckHouseOrderList(drUserUuid, drCheckHouseOrderPageTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 根据设备ID获取配送车辆订单列表
     * @Time 15:37 2024/6/20
     * @Param [drCarOrderPageTo]
     */
    @PostMapping("/dr-car-order-list")
    public DrResult postDrCarOrderList(@Validated @RequestBody DrCarOrderPageTo drCarOrderPageTo) {
        return iDrOrderService.postDrCarOrderList(drCarOrderPageTo);
    }
}
